package controllers;
 
import java.lang.reflect.InvocationTargetException;
import java.util.List;

import javax.persistence.Query;

import play.data.validation.*;
import play.db.jpa.JPA;
import play.mvc.Before;
import play.mvc.Scope.Flash;
import play.utils.Java;
import models.*;
 
public class Security extends Secure.Security {

    static boolean authenticate(@Required @Email String email, @Required String password) {
    	String customerQueryStr = "SELECT c FROM Customer c WHERE c.person.email = '" + email +"' AND c.password = '" + password +"'";
    	Customer c = Customer.find(customerQueryStr).first();
    	
    	if(c != null) {
    		System.out.println("!!!!!!!!!!!!!!");
    		System.out.println(Flash.current().get("url"));
            return true;
    	}
    	return false;
    }

	static void onDisconnected() {
	    Application.index();
	}    

}